<?php 
	function urlPageCourante() {
		$pageURL = 'http';
		// if ($_SERVER["HTTPS"] == "on") {
		// 	$pageURL .= "s";
		// }
		$pageURL .= "://";
		if ($_SERVER["SERVER_PORT"] != "80") {
			$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		} else {
			$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		}

		return $pageURL;
	}

	$description_twitter =  isset($this->descriptionDeLaPage) ? substr($this->descriptionDeLaPage, 0, 120) : null;

    $optionsFicheSejour = isset($this->fichepage) ? true : false;

?>

<div ng-app="headerModule" style="padding-bottom: 80px;">
    <div id="header_bar" ng-controller="RechercheRapideController">
        <nav class="navbar navbar-fixed-top navbar-inverse" role="navigation">
            <div class="container">

                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a id="navbar-brand" class="navbar-brand" href="/">
                        <img alt="1001treks" title="retour à la page de recherche" src="/img/small_1001treks-logo-com.png">
                        <p style="font-size: 10px; margin-bottom: 0; margin-left: 4px; margin-top: -2px; font-weight: 600; letter-spacing: 1px;">La Recherche de Séjours en Pleine Nature.</p>
                    </a>

                </div>


                <div class="collapse navbar-collapse navbar-ex1-collapse navbar-right">
                    
                    <ul class="nav navbar-nav navbar-right">

                        <?php if($optionsFicheSejour) { ?>
                            
                                <!-- <li>
                                    <a class="btn-a" href="/" >Retour aux Résultats de recherche</a>
                                </li> -->

                                <form class="navbar-form-expanded navbar-form navbar-left visible-lg-block visible-md-block visible-xs-block" ng-submit="rechercher()" novalidate>
                                    <div class="input-group">
                                        <input tooltip="{{inputRechercheRapide}}" tooltip-placement="bottom" ng-model="$parent.recherche" type="text"  placeholder="Nouvelle recherche" class="form-control" data-width-expanded="180px" data-width="130px">
                                        <span class="input-group-btn">
                                            <button tooltip="{{btnRechercheRapide}}" tooltip-placement="bottom"   type="submit" class="btn btn-default"><i class="fa fa-search"></i>&nbsp;</button>
                                        </span>
                                    </div>
                                </form>
                            
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                                    Partager <span class="caret"></span>
                                </a>
                                <ul class="dropdown-menu" role="menu">
                                    <li>
                                        <a target="_blank" title="Facebook" href="https://www.facebook.com/sharer.php?u=<?php echo urlPageCourante(); ?>&t=<?php echo $this->descriptionDeLaPage; ?>" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;">
                                            <i class="fa fa-facebook-square"></i>
                                            Facebook
                                        </a>
                                    </li>
                                    <li>
                                        <a target="_blank" title="Google +" href="https://plus.google.com/share?url=<?php echo urlPageCourante(); ?>&hl=fr" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;">
                                            <i class="fa fa-google-plus"></i>
                                            Google+
                                        </a>
                                    </li>
                                    <li>
                                        <a target="_blank" title="Twitter" href="https://twitter.com/share?url=''&text=<?php echo $description_twitter; ?>&via=1001Treks" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;">
                                            <i class="fa fa-twitter"></i>
                                            Twitter
                                        </a>
                                    </li>
                                </ul>
                            </li>

                        <?php } ?>
                        
                        <!-- <li><a href="/nous-contacter#nc">Nous contacter</a></li> -->
                    </ul>
                </div>

                <!-- /.navbar-collapse -->
            </div>
            <!-- /.container -->
        </nav>
    </div>
</div>
